#include "CurveController.h"

CurveController::CurveController(CurveModel& model, CurveView& view) :
	model(model), view(view) {
	// empty
}

CurveController::~CurveController() {
	// empty
}

void CurveController::start() {
	status = model.getStatus();
	while (!(status == MODEL_CLEARED)) {
		if (status == MODEL_NOT_INITIALIZED) {
			model.initialize();
			view.draw();
		} else if (status == MODEL_INITIALIZED) {
			if (view.canGetEvent()) {
				model.handleEvent(view.getEvent());
				view.draw();
			}
		}
		status = model.getStatus();
	}
	model.clear();
	view.close();
}
